<script>
(function() {

if (location.hash == "#stop")
    return;

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
    testRunner.setPopupBlockingEnabled(false);
}

blankWindow = open(location + "#stop");
blankWindow.onload = function() {
    blankFunc = blankWindow.Function;
    blankWindow.opener = null;
    blankWindow.eval("location = 'about:blank'");

    setTimeout(function() {
        try {
            blankFunc = blankFunc("return window.Function")();
        } catch (e) {
            blankFunc = false;
        }
        if (!blankFunc && window.testRunner) {
            testRunner.notifyDone()
            return;
        }
        blankFunc("alertFunc", "(" + function() {
            targetWindow = open("http://localhost:8080/security/resources/post-done-to-opener.html");
            targetFunc = targetWindow.Function;
            this.alertFunc = alertFunc;

            targetWindow.addEventListener("load", function() {
                alertFunc(targetFunc("return document.documentElement.innerHTML")());
            });
        } + ")()")( function(s) { alert(s) });
    }, 10);
}

window.addEventListener('message', function(evt) {
    if (evt.data == 'done') {
        if (window.testRunner)
            testRunner.notifyDone();
    }
});

})();
</script>
This test passes if it doesn't alert something ugly.
